Attribute VB_Name = "modODBCScapa"
'---------------------------------------------------------------------------------------
'Module     : modODBC
'Author     : Chris Elwell
'Purpose    : This is an example of a CIC integration module. This is for demostration
'           purposes only. You must write the code required to get/writeback data from/to
'           your customer's data source.
'
'           This example uses the AddrVerify.mdb. A DSN is setup as AddrVerify.
'           Regardless of the integration method, CICs must have a module that contains
'           specific sub routines. All of these subs/functions listed below must exist
'           as they are called from the main program.
'
'           Public Function GetData(ByVal strKey As String) As Boolean - this routine is
'               called when the Order ID field loses focus. This is where you would code to
'               get order data from a customer and populate the screen fields. You can create
'               and call as many support routines as necessary. Also, this routine should
'               return a boolean True if getting the order data was succesful and a boolean
'               False if it was not.
'           Public Function GetPickupData(ByVal strKey As String) As Boolean - this routine is
'               called when the Order ID on the FedEx Returns for field loses focus.
'               This operates the same as GetData above but for use obtaining the Pickup From
'               address info on the Call Tag/Express Tag form.
'           Public Sub WriteReply() - this is called after a successful shipment. A typical
'               use would be to write FXRS reply data back to a customer's system, but can be
'               used for anything that you want to have happen after a package is shipped.
'           Public Sub WriteReturnReply() - this is called after a successful Return Label
'               shipment. Use this to write FXRS reply data back to the customer's system.
'               This is called on both regular and online return labels.
'           Public Sub WriteBOLReply() - this is called after a successful FedEx Freight BOL shipment.
'           Public Sub WriteBatchEditReply() - this is called after a successful Batch Error
'           Edit shipment.
'           Public Sub WriteTagReply() - this is called after a successful Call/Express Tag
'           Public Sub WriteCancelTagReply() - this is called after a Call/Express Tag is Canceled
'           Public Sub WriteError() - this is called after an error is returned from FXRS.
'           Public Sub WriteDelete(ByVal strTracking As String) - this is called after a
'               package is successfully deleted.
'           Public Sub WriteReturnDelete(ByVal strTracking As String) - this is called after
'               a successful Return Label delete. Use this to write FXRS reply data back to
'               the customer's system. This is called on both regular and online return labels.
'           Public Sub AfterClose() - this is called after FXRS is closed.
'           Public Sub AfterLocationChange() - this is called after the Current Location is changed
'               on frmShip.
'           Public Sub BeforeClose() - this is called just before an FXRS close transaction
'               is sent and must return a boolean True for the Close to proceed.
'           Public Function BeforeShip() - Return TRUE to continue shipment, False to cancel.
'           Public Sub Initialize() - this is called once on program execution.
'UPDATED    Public Function BeforeBatch() - Return TRUE to process a batch file.
'UPDATED    Public Function BeforeBatchShip() - Return TRUE to process an individual batch transaction.
'           Public Sub AfterBatchShip() - this is called after each shipment in batch processing.
'           Public Sub AfterBatch() - this is called after a completed batch shipment.
'           Public Sub AfterAddrLookup() - this is called after cboCustID, cboContact, and
'                                          cboCompany lose focus
'           Public Sub AfterDeptLostFocus() - this is called after cboDept or f38 loses focus.
'           Public Sub AfterAddrVerifyUpdate() - this is called after the Update button is
'                                            clicked on the Verify Address form.
'           Public Sub AfterAddrVerify(ByVal intStatusCode As Integer) - this is called after
'               Address Verification. The status code indicates 1 address verified, 2 there was
'               a soft error returned, 3 there was a hard error returned.
'NEW        Public Function BuildCustomSPLabel(ByVal strLabel As String) As String - this is called
'               from BuildSPEPLLabel and BuildSPZPLLabel in modSmartPost. This allow CICs to create
'               custom SmartPost labels in either ZPL or EPL.
'---------------------------------------------------------------------------------------
Option Explicit


#If Scapa Then

'

Dim m_CNIn As ADODB.Connection
Dim m_CNOut As ADODB.Connection
Dim m_RS As ADODB.Recordset
' 2011-05-13, JFW, New analysis of BOM quantities
Dim m_RSbom As ADODB.Recordset ' Filter commodity lines by analysis of other lines
Dim m_strLine As String
Dim m_strKeyValue As String
Dim g_strCountry As String
Dim m_lngFeedbackLoop As Long ' Ensure we're not repeating Location change
'


'---------------------------------------------------------------------------------------
' Procedure : AfterLocationChange()
' DateTime  : 5/17/2011
' Purpose   : Remove or add custom services.
' 2011-05-17, JFW, New for Scapa
'---------------------------------------------------------------------------------------
'
Public Sub AfterLoadServices(c1 As ComboBox)

    Dim i As Long
    For i = 0 To c1.ListCount - 1
        If Left(c1.List(i), 3) = "111" Then
            c1.RemoveItem i
        End If
    Next i
    
End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : AfterLocationChange()
' DateTime  : 3/06/2006
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             the shipping Location has been changed on the Ship form.
'---------------------------------------------------------------------------------------
'
Public Sub AfterLocationChange()

    With frmShip
        If .cboLocationName(0).Text = "SCAPA-CANADA" Then
            If .f1482.Value = 1 Then .f1482.Value = 0
            .f1482.Visible = False
            .cmdViewTD.Visible = False
        End If
        If .cboLocationName(0).Text = "SCAPA" Then
            .f1482.Visible = True
            .cmdViewTD.Visible = True
            If Left(.f50.Text, 2) = "US" Then
                If .f1482.Value = 0 Then .f1482.Value = 1
            Else
                If .f1482.Value = 1 Then .f1482.Value = 0
            End If
        End If
    End With
    
End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : AfterLostFocus()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             cboDept or f38 loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterLostFocus(c1 As Control)

    Dim strCountry As String
    
    'debugprint "AfterLostFocus 0 " & c1.name & ", tab index " & c1.TabIndex
    'If Not frmShip.ActiveControl Is Nothing Then debugprint "AfterLostFocus 1 " & frmShip.ActiveControl.name & ", tab index " & frmShip.ActiveControl.TabIndex

    If c1.name = "f38" Then
        'g_clsReg.SetRegistryValue "Carry_f38", frmShip.f38, REG_SZ
    End If
    If c1.name = "f1273" Then
        'g_clsReg.SetRegistryValue "Carry_f1273", Left(frmShip.f1273.Text, 2), REG_SZ
    End If
    If c1.name = "f1274" Then
        If frmShip.f1274.Text <> "" Then
            g_clsReg.SetRegistryValue "Carry_f1274", Left(frmShip.f1274.Text, 2), REG_SZ
        End If
        
        If Left(frmShip.f1274.Text, 2) = "90" Or Left(frmShip.f1274.Text, 2) = "92" Then
            If Left(frmShip.f1273.Text, 2) <> "01" Then frmShip.f1273.Text = "01"
        End If
    End If
    
    If c1.name = "f50" Or c1.name = "f1482" Then
        ' 2011-04-26, JFW, Don't do location change on startup.
        If g_blnFormLoadComplete Then
            ' 2010-11-03, JFW, TD only per Jose.
            If Left(frmShip.f50.Text, 2) = "US" And g_strTDMasterTrkNbr <> "" _
            And frmShip.f1482.Value = 1 Then
                If True Or GetSystemName <> "WINXPC9CA96EA3" Then
                    If frmShip.cboLocationName(0).Text <> "SCAPA" Then
                        Call frmShip.SetLocationName("SCAPA")
                    End If
                End If
            Else
                If True Or GetSystemName <> "WINXPC9CA96EA3" Then
                    If frmShip.cboLocationName(0).Text <> "SCAPA-CANADA" Then
                        Call frmShip.SetLocationName("SCAPA-CANADA")
                    End If
                End If
            End If
        End If
    End If
    
    If c1.name = "f50" Then
        g_clsReg.SetRegistryValue "Carry_f50", Left(frmShip.f50.Text, 2), REG_SZ
        ' 2010-11-03, JFW, TD only per Jose.
        If Left(frmShip.f50.Text, 2) = "US" And g_strTDMasterTrkNbr <> "" Then
            If frmShip.f1482.Value <> 1 Then
                frmShip.f1482.Value = 1
            End If
            If frmShip.optCommodities.Value <> 1 Then frmShip.optCommodities.Value = 1
        ElseIf Left(frmShip.f50.Text, 2) <> "CA" Then
            If frmShip.optCommodities.Value <> 1 Then frmShip.optCommodities.Value = 1
            If frmShip.f1482.Value <> 0 Then
                frmShip.f1482.Value = 0
            End If
        Else
            If frmShip.f1482.Value <> 0 Then
                frmShip.f1482.Value = 0
            End If
        End If
    End If
    
    
'    If c1.name = "f50" Or c1.name = "f1482" Then
'        ' 2010-11-03, JFW, TD only per Jose.
'        If Left(frmShip.f50.Text, 2) = "US" And g_strTDMasterTrkNbr <> "" _
'        And frmShip.f1482.Value = 1 Then
'            If True Or GetSystemName <> "WINXPC9CA96EA3" Then
'                If frmShip.cboLocationName(0).Text <> "SCAPA" Then
'                    If m_lngFeedbackLoop <= 0 Then
'                        m_lngFeedbackLoop = m_lngFeedbackLoop + 3
'                        strCountry = Left(frmShip.f50.Text, 2)
'                        Call frmShip.SetLocationName("SCAPA")
'                        frmShip.f50.Text = strCountry
'                    Else
'                        If m_lngFeedbackLoop > 0 Then m_lngFeedbackLoop = m_lngFeedbackLoop - 1
'                    End If
'                End If
'            End If
'        Else
'            If True Or GetSystemName <> "WINXPC9CA96EA3" Then
'                If frmShip.cboLocationName(0).Text <> "SCAPA-CANADA" Then
'                    If m_lngFeedbackLoop <= 0 Then
'                        m_lngFeedbackLoop = m_lngFeedbackLoop + 3
'                        strCountry = Left(frmShip.f50.Text, 2)
'                        Call frmShip.SetLocationName("SCAPA-Canada")
'                        frmShip.f50.Text = strCountry
'                    Else
'                        If m_lngFeedbackLoop > 0 Then m_lngFeedbackLoop = m_lngFeedbackLoop - 1
'                    End If
'                End If
'            End If
'        End If
'    End If
    
    If c1.name = "f50" Or c1.name = "f1482" Then
        If Left(frmShip.f50.Text, 2) <> "CA" And frmShip.f1482.Value = 0 Then
            If 0 <> InStr(1, g_clsSettings.Setting("EDTCountries"), Left(frmShip.f50.Text & "  ", 2)) Then
                frmShip.chkETD(0).Value = 1
                frmShip.chkETD(1).Value = 1
                Call frmETD.AssignFormGlobalVars
            Else
                frmShip.chkETD(0).Value = 0
                frmShip.chkETD(1).Value = 0
                g_strETD = ""
            End If
        Else
            frmShip.chkETD(0).Value = 0
            frmShip.chkETD(1).Value = 0
            g_strETD = ""
        End If
    End If
    
    
'    ' 2010-06-03, JFW, From Jose, flow of control on frmShip
'    If c1.name = "f25" Then
'        frmShip.f116.SetFocus
'    End If
'    If c1.name = "f116" Then
'        frmShip.f1670.SetFocus
'    End If
'    If c1.name = "f1670" And c1.Parent.name = "frmShip" Then
'        frmShip.f1274.SetFocus
'    End If
'    If c1.name = "f1274" Then
'        frmShip.cboBoxName.SetFocus
'    End If
'
'    ' 2010-06-03, JFW, From Jose, flow of control on frmMPS
'    If c1.name = "f1670" And c1.Parent.name = "frmMPS" Then
'        frmMPS.cboBoxName.SetFocus
'    End If
'
'    ' 2010-06-03, JFW, From Jose, fake COD default values
'    If c1.name = "f53" And c1.Parent.name = "frmCOD" Then
'        frmCOD.optCollectType(0).Value = 1
'        frmCOD.chkCOD1stPiece.Value = 1
'    End If

    ' If Not frmShip.ActiveControl Is Nothing Then debugprint "AfterLostFocus 2 " & frmShip.ActiveControl.name

End Sub
'

' 2011-05-05, JFW, For Scapa
Public Function TDAutoCloseEnabled() As Boolean
    TDAutoCloseEnabled = True
End Function
'

Public Function ClearCommodity() As Boolean

End Function
'

Public Function ClearShipScreen() As Boolean

    On Error Resume Next
    frmShip.f38 = g_clsReg.GetRegistryValue("Carry_f38", "")
    frmShip.f50 = g_clsReg.GetRegistryValue("Carry_f50", "")
    frmShip.f75 = g_clsReg.GetRegistryValue("Carry_f75", "")
    frmShip.f1274 = g_clsReg.GetRegistryValue("Carry_f1274", "")

End Function
'

'---------------------------------------------------------------------------------------
' Procedure : Connect()
' DateTime  : 7/5/2004
' Purpose   : Open connection to ODBC test DSN. Instantiate module level recordset.
'---------------------------------------------------------------------------------------
'
Private Function Connect() As Boolean
    On Local Error GoTo Handler
    Dim strDSN As String
    Dim boolSecondTry As Boolean

    If m_CNIn Is Nothing Then
        Set m_CNIn = New ADODB.Connection
    End If
    If m_CNOut Is Nothing Then
        Set m_CNOut = New ADODB.Connection
    End If

    If m_CNIn.State <> adStateOpen Then   'if connection is not open then do so
        If GetSystemName = "WINXPC9CA96EA3" Then
            m_CNIn.Open "DSN=ScapaFedEx"
        Else
            m_CNIn.Open "DSN=MES_Renfrew"
        End If
        Set m_CNOut = m_CNIn
    End If
    
    Connect = True

    Exit Function

Handler:
'    If Not boolSecondTry Then
'        boolSecondTry = True
'        If Err.number = -2147467259 Then
'            Call AddDSN
'            Resume
'        End If
'    End If
    MsgBox Err.Description, , "modODBC.Connect"
    ' Call Kill        'kill connection and recordset

End Function
'


'---------------------------------------------------------------------------------------
' Procedure : GetData()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Called from frmShip.f1_LostFocus, which is the OrderID field.
'             Call routines needed to get data from the customer's system and assign the
'             value to the appropriate fields on the Ship form. This example uses ODBC.
'---------------------------------------------------------------------------------------
'
Public Function GetData(ByVal strKey As String) As Boolean
    On Local Error GoTo Handler
    Dim strSelect As String
    Dim strUserPwd As String    'DSN user and password separated by ','
    Dim strUser As String       'DSN user name
    Dim strPwd As String        'DSN user password
    Dim strData As String
    Dim i As Long

'    If g_clsReg.GetRegistryValue("IntegrationLevel", "Writeback") <> "Writeback" _
'    And g_clsReg.GetRegistryValue("IntegrationLevel", "Writeback") <> "Order Lookup" Then
'        GetData = True
'        Exit Function
'    End If

    If Left(strKey, 2) <> "00" Then
        strKey = "00" & strKey
        frmShip.f1.Text = strKey
    End If
    
    m_strKeyValue = strKey

    strSelect = "select * from SAP_DEL_DATA where DELNUMBER = '" & m_strKeyValue & "' order by DELNUMBER, DELLINENUMBER"

    ' debugprint "GetData, Select " & strSelect

    If Not Connect Then Exit Function   'set conection and recordset

    Set m_RS = New ADODB.Recordset
    m_RS.CursorLocation = adUseClient
    m_RS.Open strSelect, m_CNIn, adOpenStatic      'run SELECT

    Set m_RSbom = New ADODB.Recordset
    m_RSbom.CursorLocation = adUseClient
    m_RSbom.Open strSelect, m_CNIn, adOpenStatic      'run SELECT

    ' debugprint "GetData, DeleteIntlCommodities"

    Call DeleteIntlCommodities(m_strKeyValue)

    If m_RS.BOF Or m_RS.EOF Then
        strData = "No records"
        Exit Function
    Else
        For i = 0 To m_RS.Fields.Count - 1
            strData = strData & vbCrLf & m_RS.Fields(i).name & " " & m_RS.Fields(i).Value
        Next i
    End If

    strData = "Record count " & m_RS.RecordCount & vbCrLf & strData

    ' debugprint "GetData, GetDataToShip"

    Call GetDataToShip

    ' Example use of the SetMessage sub
    ' Call SetMessage("Destination state is: " & m_RS!State, 16, vbBlack, True)

    ' debugprint "GetData, 1670"

    If frmShip.f116.Enabled Then frmShip.f116.SetFocus

    ' debugprint "GetData, Done"

    GetData = True
Release:
    ' call kill
    Exit Function
Handler:
    MsgBox Err.Description, , "modODBC.GetData"
    ' Call Kill
    Resume Release
    Resume

End Function
'

'---------------------------------------------------------------------------------------
' Procedure : GetData()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Called from frmShip.f1_LostFocus, which is the OrderID field.
'             Call routines needed to get data from the customer's system and assign the
'             value to the appropriate fields on the Ship form. This example uses ODBC.
'---------------------------------------------------------------------------------------
'
Public Sub GetDataToShip()

    On Local Error GoTo Handler

    Dim strZipCode As String
    Dim intZipLen As Integer
    Dim lngWeight As Double
    Dim strHarmCode As String
    Dim strMyHarmCode As String
    Dim strCCofMan  As String
    Dim strTaxID As String
    Dim i As Long, j As Long
    Dim strAddressLine As String
    Dim strPhone As String
    Dim rsZip As New ADODB.Recordset
    Dim strSoldTo As String
    ' 2011-05-13, JFW, New analysis of BOM quantities
    Dim dblQuantity As Double
    
'    ' Declare variables for procedure
'    Dim i As Long
'    Dim blnADDComm As Boolean
'    Dim strCommCode As String
'    Dim strSQLComm As String
'    Dim strMeter As String

    With frmShip

        g_strErrorLocation = "Country"
        strZipCode = Trim(m_RS!SHIPTOZIP & "")
        strZipCode = Replace(strZipCode, " ", "")
        strZipCode = Replace(strZipCode, "-", "")
        g_strCountry = Trim(m_RS!Country & "")
        If g_strCountry = "" Then
            If IsNumeric(strZipCode) Then
                g_strCountry = "US"
            Else
                g_strCountry = "CA"
            End If
        End If
        .f50.Text = g_strCountry
        DoEvents
        Call AfterLostFocus(frmShip.f50)
        DoEvents
        .f50.Text = g_strCountry
        DoEvents
 
        .f17.Text = strZipCode
        DoEvents

        ' Whatever is on screen
'        If g_strCountry = "US" Then
'            .f1482.Value = 1
'        Else
'            .f1482.Value = 0
'        End If

        '        g_strErrorLocation = "AccountSwitch"
        '        If True Or False Then
        '        If GetSystemName <> "CAN00278478" Then
        '            If g_strCountry = "US" Then
        '                If Not SetCurrentAccount("224037961") Then
        '                    MsgBox "Unable to switch to US account 224037961.  Please select account from Location box", vbExclamation, "Error"
        '                End If
        '            Else
        '                If Not SetCurrentAccount("221737920") Then
        '                    MsgBox "Unable to switch to account 221737920.  Please select account from Location box", vbExclamation, "Error"
        '                End If
        '            End If
        '        End If
        '        End If

        If g_strCountry = "US" Then
            rsZip.Open "select * from ZipCityState where PostalCode = '" & Left(strZipCode, 5) & "' " _
                            & "and Country = '" & g_strCountry & "' " _
                            & "order by 1,2,3" _
                , g_connFSMSClient
        Else
            For i = 0 To (Len(strZipCode) - 1)
                If rsZip.State > 0 Then rsZip.Close
                rsZip.Open "select * from ZipCityState where PostalCode = '" & Left(strZipCode, Len(strZipCode) - i) & "' " _
                            & "and Country = '" & g_strCountry & "' " _
                                & "order by 1,2,3" _
                    , g_connFSMSClient
                If Not rsZip.BOF Then
                    Exit For
                End If
            Next i
        End If

        .f11.Text = Trim(m_RS!SHIPTONAME1 & "")
        .f12.Text = Trim(m_RS!SHIPTONAME2 & "")
        .f13.Text = Trim(m_RS!SHIPTOADDRESS & "")
        .f15.Text = Trim(m_RS!SHIPTOCITY & "")
        .f16.Text = Trim(m_RS!SHIPTOSTATE & "")
        DoEvents
        Call LoadCity(.f15, .f16, .f17, .f50)
        DoEvents
        
        ' Phone f18
        If .f18.Text & "" = "" Then
            strPhone = UCase(Trim(m_RS!SHIPTOTELEPHONE & ""))
            strPhone = Replace(strPhone, "PH", "")
            strPhone = Replace(strPhone, "CBD", "")
            strPhone = Replace(strPhone, ":", "")
            strPhone = Replace(strPhone, "-", "")
            strPhone = Replace(strPhone, "(", "")
            strPhone = Replace(strPhone, ")", "")
            strPhone = Replace(strPhone, " ", "")
            If IsNumeric(strPhone) Then
                If Len(strPhone) = 11 Then strPhone = Right(strPhone, 10)
                .f18.Text = strPhone
                strAddressLine = ""
            End If
        End If

        ' Must have phone number
        If .f18.Text & "" = "" Then
            .f18.Text = g_str183
        End If

        .f25.Text = Trim(CStr(m_RS!DELNUMBER & ""))
        .f3056.Text = Trim(m_RS!DELNUMBER & "")
        .f3057.Text = Trim(m_RS!SALESORDERNO & "")

        .f1273 = "01"
        .f1670 = 1
        .f116 = 1
        If g_strCountry = "CA" Or g_strCountry = "US" Then
            .f1274 = "92"
        Else
            .f1274 = "01"
        End If
        .f23 = 1
        .f70 = 1
        .f72 = 1
        
        'debugprint "1090 " & .f1090.Text
        If Left(.f50.Text, 2) = "CA" Then
            .f68.Text = "CAD"
            .f1090.Text = "CAD"
        ElseIf Left(.f50.Text, 2) = "US" Then
            If .f68.Text = "" Then
                .f68.Text = "USD"
            End If
            If .f1090.Text = "" Then
                .f1090.Text = "USD"
            End If
        Else
            If .f68.Text = "" Then
                .f68.Text = "CAD"
            End If
            If .f1090.Text = "" Then
                .f1090.Text = "CAD"
            End If
        End If
        
        g_strErrorLocation = "Commodities"
        
        Do While Not m_RS.EOF
            ' Start with line item quantity
            dblQuantity = NumericValue(m_RS!DELQUANTITY)
            If NumericValue(m_RS!DELLINENUMBER) < 90000 Then
                ' Main line item, replace quantity with total quantity from matching detail lines
                If Not m_RSbom.BOF And Not m_RSbom.EOF Then
                    m_RSbom.MoveFirst
                    Do While Not m_RSbom.EOF
                        If Trim(m_RS!MATERIALNUMBER) = Trim(m_RSbom!MATERIALNUMBER) Then
                            If NumericValue(m_RSbom!DELLINENUMBER) > 900000 Then
                                dblQuantity = dblQuantity + NumericValue(m_RSbom!DELQUANTITY, False)
                            End If
                        End If
                        m_RSbom.MoveNext
                    Loop
                    m_RSbom.MoveFirst
                End If
            ElseIf NumericValue(m_RS!DELLINENUMBER) > 900000 Then
                ' Detail line item, ignore it if there's a matching main line item
                If Not m_RSbom.BOF And Not m_RSbom.EOF Then
                    m_RSbom.MoveFirst
                    Do While Not m_RSbom.EOF
                        If Trim(m_RS!MATERIALNUMBER) = Trim(m_RSbom!MATERIALNUMBER) Then
                            If NumericValue(m_RSbom!DELLINENUMBER) < 90000 Then
                                dblQuantity = 0
                            End If
                        End If
                        m_RSbom.MoveNext
                    Loop
                    m_RSbom.MoveFirst
                End If
            End If
            
            If dblQuantity > 0 Then
            
                g_strErrorLocation = "HarmCode"
                ' Setting Harmonized code
                strHarmCode = Trim(m_RS!COMMODITYCODE & "")
                strHarmCode = PhoneTrim(strHarmCode)
                If strHarmCode <> "" Then
                    strHarmCode = strHarmCode & "0000000000"
                    strMyHarmCode = Left(strHarmCode, 10)
                    strHarmCode = strMyHarmCode
                    'strHarmCode = Left(strMyHarmCode, 4) & "."
                    'strHarmCode = strHarmCode & Mid(strMyHarmCode, 5, 2) & "."
                    'strHarmCode = strHarmCode & Right(strMyHarmCode, 4)
                End If
                
                g_strErrorLocation = "CommodityInsert"
                Call InsertIntlCommodities(Trim(CStr(m_RS!DELNUMBER & "")), _
                    0, _
                    IIf(Trim(m_RS!COMCODEDESC & "") <> "", Trim(m_RS!COMCODEDESC & ""), "Adhesive tape"), _
                    m_RS!COUNTRYOFORIGIN & "", _
                    m_RS!COMMODITYCODE & "", _
                    CStr(dblQuantity), _
                    "", _
                    "", _
                    "EA" & "", _
                    CStr(NumericValue(m_RS!NETVALUE) / dblQuantity), _
                    CStr(NumericValue(m_RS!NETVALUE)), _
                    m_RS!COMMODITYCODE & "", _
                    m_RS!MATDESC & "" _
                    )
                
            End If ' Quantity > 0
            
            g_strErrorLocation = "CommNext"
            m_RS.MoveNext
        Loop
        
        Call frmShip.SetCommodSummary

        
        'debugprint "1090 " & .f1090.Text
        
'        .f1358.Text = Trim(CStr(m_RS!CompanyTaxNo & ""))
'        If .f1358.Text = "" Then
'            .f1358.Text = Trim(CStr(m_RS!GstExemptNum & ""))
'        End If

'        If Not m_RSCustomer.BOF And Not m_RSCustomer.EOF Then
'            strZipCode = Trim(m_RSCustomer!SoldPostalCode & "")
'            strZipCode = Replace(strZipCode, " ", "")
'            strZipCode = Replace(strZipCode, "-", "")
'            If strZipCode <> "" And .f17.Text <> strZipCode Then
'                If Trim(m_RSCustomer!Contact & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!Contact & "")
'                End If
'                If Trim(m_RSCustomer!name & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!name & "")
'                End If
'                If Trim(m_RSCustomer!SoldToAddr1 & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!SoldToAddr1 & "")
'                End If
'                If Trim(m_RSCustomer!SoldToAddr2 & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!SoldToAddr2 & "")
'                End If
'                If Trim(m_RSCustomer!SoldToAddr3 & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!SoldToAddr3 & "")
'                End If
'                If Trim(m_RSCustomer!SoldToAddr4 & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!SoldToAddr4 & "")
'                End If
'                If Trim(m_RSCustomer!SoldPostalCode & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!SoldPostalCode & "")
'                End If
'                If Trim(m_RSCustomer!Telephone & "") <> "" Then
'                    strSoldTo = strSoldTo & IIf(strSoldTo <> "", ", ", "") & Trim(m_RSCustomer!Telephone & "")
'                End If
'
'                If strSoldTo <> "" Then
'                    Call InsertIntlCommodities(.f1.Text, 0, "SoldTo: " & strSoldTo, "CA", "", 1, "", "", "EA", "0.000001", "0.01", "SOLDTO", "")
'                End If
'
'                If .f1358.Text = "" Then
'                    .f1358.Text = Trim(CStr(m_RS!GstExemptNum & ""))
'                End If
'
'            End If
'        End If

    End With

    g_strErrorLocation = "Done"
Release:
    ' call kill
    Exit Sub
Handler:
    MsgBox "Error at " & g_strErrorLocation & " - " & Err.Description, , "modODBC.GetDataToShip"
    ' Call Kill
    Resume Release
    Resume

End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : GetPickupData()
' DateTime  : 1/30/2006
' Purpose   : REQUIRED SUB. Called from frmAddTags.f1_LostFocus, which is the OrderID field.
'             Call routines needed to get data from the customer's system and assign the
'             value to the appropriate fields on the Ship form. This example uses ODBC.
'---------------------------------------------------------------------------------------
'
Public Function GetPickupData(ByVal strKey As String) As Boolean


    GetPickupData = True

End Function
'---------------------------------------------------------------------------------------
' Procedure : WriteReply()
' DateTime  : 2/14/2005
' Purpose   : REQUIRED SUB. Called after a successful ship transaction.
'             This example shows how to obtain multiple occurrence fields from the
'             FXRS reply and how to obtain multiple occurrence fields included in the
'             input transaction but not returned in the FXRS reply.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReply()

    On Local Error GoTo Handler
    
    ' Declare variables for procedure
    Dim strSQL As String
    
    Dim i As Integer
    Dim j As Integer
    
    Dim f1 As String                    'OrderID (in TransID field)
    Dim f35 As String                   'Total surcharges
    Dim f37 As String                   'Net charge
    Dim f60 As String                   'Billed weight
    Dim f116 As String                  'Num pkgs
    Dim strInsert As String             'SQL INSERT
    Dim strMPS As String                'MPS SELECT query
    Dim rsMPS As New ADODB.Recordset    'Used to capture MPS input fields
    
    'Declare string arrays for trk#s and declared values
    Dim str29() As String
    Dim str26() As String
    
    Dim intNumPkgs As Integer

    If g_clsReg.GetRegistryValue("IntegrationLevel", "Writeback") <> "Writeback" Then
        Exit Sub
    End If

    ' Writebank integrated only
    If g_str1 = "" Then
        Exit Sub
    End If
    
    g_strErrorLocation = "Connect"
    
    ' Validate Connection object
    If Not Connect Then Exit Sub

    'Get # of pkgs
    g_strErrorLocation = "116"
    intNumPkgs = Val(g_str116)
    
    'ReDim the string array using the # of pkgs
    ReDim str29(intNumPkgs)
    ReDim str26(intNumPkgs)
    
    'Get the fields you wish from the reply transaction
    g_strErrorLocation = "Parser"
    With frmShip.g_clsParser
        For i = 0 To .TotalFields - 1
            Select Case .Field(i)
                Case "1"
                    f1 = .Data(i)           'TransID
                Case "29"
                    str29(1) = .Data(i)     'First trk#
                Case "35"
                    f35 = .Data(i)          'Total Surcharges
                Case "37"
                    f37 = .Data(i)          'Net Charges
                Case "60"
                    f60 = .Data(i)          'Billed Weight
                Case "116"
                    f116 = .Data(i)         '# Pkgs
            End Select
            
            'Get multiple occurrence tracking #s
            'Note: This will capture Int'l MPS child trk#s as well as domestic MPS
            If intNumPkgs > 1 And frmShip.chkDuplicate = 0 Then
                For j = 2 To intNumPkgs
                    If .Field(i) = "29-" & Trim(Str(j)) Then str29(j) = .Data(i)
                Next
            End If
        Next
    End With
    
    g_strErrorLocation = "MPS"
    'Query to get fields saved in MPS table for MPS transactions
    ' 2006-11-07, JFW, Add order to MPS select to preserve package order
    strMPS = "SELECT * FROM MPS WHERE f1 = '" & f1 & "' order by ShipDate"
    'Open recordset
    rsMPS.Open strMPS, g_connFSMSClient, adOpenStatic, adLockBatchOptimistic
    
    'Perform Insert query for each package
    g_strErrorLocation = "NumPkgs"
    For i = 1 To intNumPkgs
        If str29(i) <> "" Then

            If Not IsNumeric(g_str1670) Then
                g_str1670 = 1
            End If
            
            g_strErrorLocation = "SQL insert"
            ' Set SQL statement
            strSQL = "Insert Into FEDEX_TRACKING ("
            strSQL = strSQL & "SHIPDATE,"
            strSQL = strSQL & "DELIVERYNO,"
            strSQL = strSQL & "TRACKINGNO)"
            strSQL = strSQL & " Values ("
            If IsDate(g_str24) Then
                strSQL = strSQL & "'" & Format(CDate(g_str24), "yyyy-mm-dd") & "',"
            Else
                strSQL = strSQL & "'" & Format(Date, "yyyy-mm-dd") & "',"
            End If
            strSQL = strSQL & "'" & g_str1 & "',"
            strSQL = strSQL & "'" & str29(i) & "')"
    
            ' debugprintstrSQL
            
            m_CNOut.Execute strSQL
            
        End If ' str29
        
    Next i
    
    frmShip.f1274 = g_clsReg.GetRegistryValue("Carry_f1274", "")
    
    g_strErrorLocation = "Done"
    
Release:
    ' call kill
    If rsMPS.State = adStateOpen Then rsMPS.Close
    Set rsMPS = Nothing
    Exit Sub

Handler:
    MsgBox "Error at " & g_strErrorLocation & " - " & Err.Description, , "modODBC.WriteReply"
    Resume Release

End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteReturnReply()
' DateTime  : 7/14/2005
' Purpose   : REQUIRED SUB. Called after a successful return label transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReturnReply()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteBOLReply()
' DateTime  : 1/11/2006
' Purpose   : REQUIRED SUB. Called after a successful FedEx Freight BOL transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteBOLReply()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteBatchEditReply()
' DateTime  : 1/17/2006
' Purpose   : REQUIRED SUB. Called after a successful Batch Error Edit transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteBatchEditReply()

End Sub
' Procedure : WriteTagReply()
' DateTime  : 1/26/2006
' Purpose   : REQUIRED SUB. Called after a successful Call Tag/Express Tag transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteTagReply()

End Sub
' Procedure : WriteCancelTagReply()
' DateTime  : 1/26/2006
' Purpose   : REQUIRED SUB. Called after a successful Cancel Call Tag/Express Tag transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteCancelTagReply()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteReturnDelete()
' DateTime  : 7/14/2005
' Purpose   : REQUIRED SUB. Called after a successful return label delete transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReturnDelete(ByVal strTracking As String)

End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteError()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             an FXRS Error reply transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteError()
    MsgBox "Shipping Error: " & g_str3, vbCritical, "FSMS Error"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteDelete()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             successful FXRS Delete.
' Called    : frmShip g_clsParser_Parsecomplete() event on FSMS 123 reply
'---------------------------------------------------------------------------------------
'
Public Sub WriteDelete(ByVal strTracking As String)

    On Local Error GoTo Handler
    
    ' Declare variables for procedure
    Dim strSQL As String
    
    Dim i As Integer
    Dim j As Integer
    
    Dim f1 As String                    'OrderID (in TransID field)
    Dim f35 As String                   'Total surcharges
    Dim f37 As String                   'Net charge
    Dim f60 As String                   'Billed weight
    Dim f116 As String                  'Num pkgs
    Dim strInsert As String             'SQL INSERT
    Dim strMPS As String                'MPS SELECT query
    Dim rsMPS As New ADODB.Recordset    'Used to capture MPS input fields
    
    'Declare string arrays for trk#s and declared values
    Dim str29() As String
    Dim str26() As String
    
    Dim intNumPkgs As Integer

    If g_clsReg.GetRegistryValue("IntegrationLevel", "Writeback") <> "Writeback" Then
        Exit Sub
    End If

    ' Validate Connection object
    g_strErrorLocation = "Connect"
    If Not Connect Then Exit Sub

'    'Get # of pkgs
'    g_strErrorLocation = "116"
'    intNumPkgs = Val(g_str116)
'
'    'ReDim the string array using the # of pkgs
'    ReDim str29(intNumPkgs)
'    ReDim str26(intNumPkgs)
'
'    'Get the fields you wish from the reply transaction
'    g_strErrorLocation = "Parser"
'    With frmShip.g_clsParser
'        For i = 0 To .TotalFields - 1
'            Select Case .Field(i)
'                Case "1"
'                    f1 = .Data(i)           'TransID
'                Case "29"
'                    str29(1) = .Data(i)     'First trk#
'                Case "35"
'                    f35 = .Data(i)          'Total Surcharges
'                Case "37"
'                    f37 = .Data(i)          'Net Charges
'                Case "60"
'                    f60 = .Data(i)          'Billed Weight
'                Case "116"
'                    f116 = .Data(i)         '# Pkgs
'            End Select
'
'            'Get multiple occurrence tracking #s
'            'Note: This will capture Int'l MPS child trk#s as well as domestic MPS
'            If intNumPkgs > 1 And frmShip.chkDuplicate = 0 Then
'                For j = 2 To intNumPkgs
'                    If .Field(i) = "29-" & Trim(Str(j)) Then str29(j) = .Data(i)
'                Next
'            End If
'        Next
'    End With
'
'    g_strErrorLocation = "MPS"
'    'Query to get fields saved in MPS table for MPS transactions
'    ' 2006-11-07, JFW, Add order to MPS select to preserve package order
'    strMPS = "SELECT * FROM MPS WHERE f1 = '" & f1 & "' order by ShipDate"
'    'Open recordset
'    rsMPS.Open strMPS, g_connFSMSClient, adOpenStatic, adLockBatchOptimistic
'
'    'Loop through the MPS recordset and assign the Declared Value fields
'    'Note: You can also capture any other MPS field using this loop by declaring
'    'variables for those data element assigning the values here.
'    g_strErrorLocation = "DV"
'    i = 1
'    If Not rsMPS.EOF Then
'        Do Until rsMPS.EOF
'            str26(i) = rsMPS!g_str26 & ""
'            rsMPS.MoveNext
'            i = i + 1
'        Loop
'    Else
'        str26(1) = g_str26
'    End If
'
'    'Perform Insert query for each package
'    g_strErrorLocation = "NumPkgs"
'    For i = 1 To intNumPkgs
'        If str29(i) <> "" Then
'
'            If Not IsNumeric(g_str1670) Then
'                g_str1670 = 1
'            End If
'
'            g_strErrorLocation = "SQL insert"
'            ' Set SQL statement
'            strSQL = "Insert Into FEDEX_TRACKING ("
'            strSQL = strSQL & "SHIPDATE,"
'            strSQL = strSQL & "DELIVERYNO,"
'            strSQL = strSQL & "TRACKINGNO)"
'            strSQL = strSQL & " Values ("
'            strSQL = strSQL & "'" & g_str24 & "',"
'            strSQL = strSQL & "'" & g_str1 & "',"
'            strSQL = strSQL & "'" & str29(i) & "')"
'
'            m_CNOut.Execute strSQL
'
'        End If ' str29
'
'    Next i
    
            g_strErrorLocation = "SQL insert"
            strSQL = "Delete from FEDEX_TRACKING Where TRACKINGNO = '" & strTracking & "'"
            m_CNOut.Execute strSQL
    
    g_strErrorLocation = "Done"
    
Release:
    ' call kill
    If rsMPS.State = adStateOpen Then rsMPS.Close
    Set rsMPS = Nothing
    Exit Sub

Handler:
    MsgBox "Error at " & g_strErrorLocation & " - " & Err.Description, , "modODBC.WriteReply"
    Resume Release
End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterClose()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             FXRS Close.
'---------------------------------------------------------------------------------------
'
Public Sub AfterClose()

End Sub
'

' 2007-04-13, JFW, Allow for custom screen display.
Public Sub AfterConnect()

    ' 2007-12-07, JFW, Large address book making a slow start on some clients.
    ' Call frmShip.ToggleLookup(True)
    On Error Resume Next
    'Call frmShip.ToggleDepartment(True)
    frmShip.f70.ListIndex = 0
    frmShip.f72.ListIndex = 0
    frmShip.f38 = g_clsReg.GetRegistryValue("Carry_f38", "")
    frmShip.f50 = g_clsReg.GetRegistryValue("Carry_f50", "")
    frmShip.f75 = g_clsReg.GetRegistryValue("Carry_f75", "")
    frmShip.f1274 = g_clsReg.GetRegistryValue("Carry_f1274", "")

    Call Initialize(frmShip)
    
End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : BeforeClose()
' DateTime  : 7/12/2006
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed before
'             FXRS Close.
'---------------------------------------------------------------------------------------
'
Public Function BeforeClose() As Boolean

    BeforeClose = True

End Function
'


' 2012-01-19, JFW, New for UCS.
Public Function BeforeGotFocus(f As Form, c As Control) As Boolean
    On Error GoTo Test
    Exit Function
Test:
    DebugPrint "BeforeGotFocus, " & Err.Description
    
End Function

'---------------------------------------------------------------------------------------
' Procedure : BeforeShip()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED Function. Modified to Return Boolean which controls whether or not
'             the shipment will continue or be canceled. Return True to continue shipment,
'             False to cancel.
'---------------------------------------------------------------------------------------
'
Public Function BeforeShip(Optional ByRef TransString As String = "") As Boolean

    Dim objRetVal As VbMsgBoxResult

'    If TransString <> "" Then
'        TransactionStripTag TransString, "583"
'        TransactionBuilder TransString, "583", g_str1670
'        TransString = Replace(TransString, "99,""""", "")
'        TransactionBuilder TransString, 99, ""
'    End If

    BeforeShip = True

    If frmShip.f25 = "" Then
        MsgBox "Reference is mandatory.", vbApplicationModal + vbSystemModal
        frmShip.SSTab1.Tab = 0
        frmShip.f25.SetFocus
        BeforeShip = False
    End If


    With frmShip
        If Left(.f50.Text, 2) <> "CA" Then
            If Not IsNumeric(Trim(.txtTotCustVal.Text)) Then
                If .f1482.Value = 0 Then
                    'objRetVal = MsgBox("This " & IIf(.f1482.Value = 1, "TD", "Intl") & " shipment has no customs value.  Please return and correct.")
                    'BeforeShip = False
                End If
            ElseIf CDbl(Trim(.txtTotCustVal.Text)) <= 0 And .f1482.Value = 0 Then
                ' 2011-05-17, JFW, Only for Intl, TD no commodityl.
                objRetVal = MsgBox("This " & IIf(.f1482.Value = 1, "TD", "Intl") & " shipment has no customs value.  Please return and correct.")
                BeforeShip = False
            ' Low value OK
            ' ElseIf CDbl(Trim(.txtTotCustVal.Text)) <= 1 Then
                ' 2011-05-16, JFW, Not for Scapa, per Jose.
                'objRetVal = MsgBox("This " & IIf(.f1482.Value = 1, "TD", "Intl") & " shipment has little customs value.  OK or cancel to return and correct.", vbOKCancel + vbDefaultButton2)
                'If objRetVal = vbOK Then
                'Else
                '    BeforeShip = False
                'End If
            ElseIf CDbl(Trim(.txtTotCustVal.Text)) >= 2000 And Left(.f50.Text, 2) <> "US" And frmShip.chkB13A.Value <> 1 Then
                objRetVal = MsgBox("This " & IIf(.f1482.Value = 1, "TD", "Intl") & " shipment requires a B13A declaration.  OK for none or cancel to return and correct.", vbOKCancel + vbDefaultButton2)
                If objRetVal = vbOK Then
                Else
                    BeforeShip = False
                End If
            End If
        End If
    End With

End Function
'

'---------------------------------------------------------------------------------------
' Procedure : BeforeShipTrans()
' DateTime  : 8/7/2008
' Purpose   : REQUIRED Function. Modified to Return Boolean which controls whether or not
'             the shipment will continue or be canceled. Return True to continue shipment,
'             False to cancel.
'---------------------------------------------------------------------------------------
'
Public Function BeforeShipTrans(ByRef TransString As String) As Boolean
    
    Dim lngMsgBoxResult As VbMsgBoxResult
    
    BeforeShipTrans = True
    
End Function
'

'---------------------------------------------------------------------------------------
' Procedure : Initialize()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed on
'             program execution.
'---------------------------------------------------------------------------------------
'
Public Sub Initialize(Optional f1 As Form)

    On Error Resume Next
    
    If Not f1 Is Nothing Then
        If f1.name = "frmShip" Then
            f1.f38.Text = g_clsReg.GetRegistryValue("Carry_f38", "")
            f1.f50.Text = g_clsReg.GetRegistryValue("Carry_f50", "")
            f1.f75.Text = g_clsReg.GetRegistryValue("Carry_f75", "")
            f1.f1274.Text = g_clsReg.GetRegistryValue("Carry_f1274", "")
            frmShip.cboShipmentType = "All"
            
            With f1
                .f116.TabIndex = .f25.TabIndex + 1
                .f1670.TabIndex = .f116.TabIndex + 1
                .f1274.TabIndex = .f1670.TabIndex + 1
                .f1273.TabIndex = .f1274.TabIndex + 1
                .cboBoxName.TabIndex = .f1273.TabIndex + 1
                .f59.TabIndex = .cboBoxName.TabIndex + 1
                .f58.TabIndex = .f59.TabIndex + 1
                .f57.TabIndex = .f58.TabIndex + 1
                .f24.TabIndex = .f57.TabIndex + 1
                .f26.TabIndex = .f24.TabIndex + 1
                .f23.TabIndex = .f26.TabIndex + 1
                .f20.TabIndex = .f23.TabIndex + 1
            End With
        End If
        
        ' 2010-06-03, JFW, From Jose, flow of control on frmMPS
        If f1.name = "frmMPS" Then
            f1.cboBoxName.TabIndex = frmMPS.f1670.TabIndex + 1
            f1.cmdAddMPS.TabIndex = frmMPS.cboBoxName.TabIndex + 1
        End If
        
        ' 2010-06-03, JFW, From Jose, flow of control on frmMPS
        If f1.name = "frmCOD" Then
            f1.optCollectType(1).Value = 1
            f1.chkCOD1stPiece.Value = 1
        End If
        
    End If
    Exit Sub

ErrorExit:
    MsgBox Err.Description, vbApplicationModal, "modODBC.Initialize"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : BeforeBatch()
' DateTime  : 20070621-01 Changed BeforeBatch to return a boolean
' Purpose   : REQUIRED SUB. Called before an entire batch is processed.
'---------------------------------------------------------------------------------------
'
Public Function BeforeBatch() As Boolean

    BeforeBatch = True

End Function
'---------------------------------------------------------------------------------------
' Procedure : BeforeBatchShip()
' DateTime  : 20070822-02 Modified BeforeBatchShip to return a Boolean.
' Purpose   : REQUIRED SUB. Called just before a batch transaction is sent to the server.
'---------------------------------------------------------------------------------------
'
Public Function BeforeBatchShip() As Boolean

    BeforeBatchShip = True

End Function
'---------------------------------------------------------------------------------------
' Procedure : AfterBatchShip()
' DateTime  : 10/28/2005
' Purpose   : REQUIRED SUB. Called just after a batch transaction has been processed.
'---------------------------------------------------------------------------------------
'
Public Sub AfterBatchShip()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterBatch()
' DateTime  : 4/6/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             a batch shipment has been completed.
'---------------------------------------------------------------------------------------
'
Public Sub AfterBatch()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterAddrLookup()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             cboCustID, cboContact, or cboCompany loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrLookup()
    frmShip.f25.SetFocus
End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterDeptLostFocus()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             f38 loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterDeptLostFocus()

    On Error Resume Next
    g_clsReg.SetRegistryValue "Carry_f38", frmShip.f38, REG_SZ

End Sub
'

' 2011-07-10, JFW, New interface to clear DG disclaimer automatically.
Public Function AfterDGDisclaimer() As Boolean
    AfterDGDisclaimer = False
End Function
'

' 2007-04-13, JFW, Allow for custom screen display.
Public Sub AfterDisconnect()

    On Error Resume Next
    
End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : AfterAddrVerifyUpdate()
' DateTime  : 9/13/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             an address has been updated on the Ship form.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrVerifyUpdate()

End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : AfterAddrVerify()
' DateTime  : 5/12/2006
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             Address Verification. Three possible status codes are passed. See comments
'             below.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrVerify(ByVal intStatusCode As Integer)

    Select Case intStatusCode
        'Address is verfified
        Case 1

        'Soft error
        Case 2

        'Hard error
        Case 3

    End Select

End Sub
'

'---------------------------------------------------------------------------------------
' Procedure : BuildCustomSPLabel()
' DateTime  : 20070620-04
' Purpose   : REQUIRED SUB. Can be used as hook to create custom EPL or ZPL buffer labels
'             for SmartPost.
'---------------------------------------------------------------------------------------
'
Public Function BuildCustomSPLabel(ByVal strLabel As String) As String

    BuildCustomSPLabel = strLabel

End Function
'

'---------------------------------------------------------------------------------------
' Procedure : AfterRateQuote()
' DateTime  : 20071106-01
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             a rate quote.
'---------------------------------------------------------------------------------------
'
Public Sub AfterRateQuote()

End Sub


' 2012-01-19, JFW, New for UCS.
Public Function AfterScreenChange(f As Form) As Boolean

End Function



#End If





